package com.ysw.rpc.server.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;

import java.util.concurrent.Executor;

/**
 * @author YinShangwen
 * @since 2023/4/9 16:49
 */
public class ServerAutoConfiguration {

    @Bean
    @ConfigurationProperties(prefix = "y-rpc.server")
    public ServerProperties serverProperties() {
        return new ServerProperties();
    }

    @Bean
    public ServerInitializerConfig serverInitializer(ServerProperties serverProperties, Executor executor) {
        return new ServerInitializerConfig(serverProperties, executor);
    }

    @Bean
    public NacosDiscoveryPropertiesBeanPostProcessor nacosDiscoveryPropertiesBeanPostProcessor(ServerProperties serverProperties) {
        return new NacosDiscoveryPropertiesBeanPostProcessor(serverProperties);
    }

}
